HAL SMBUS migration: List of applicable concepts ¶
This section provides information about the HAL SMBUS applicable architecture concepts.
Concepts for SMBUS ¶
|
Concept |
Description |
|---|---|
|
The initialization has been split into separate init and config functions:
|
|
|
Removal and conversion of init structure to configuration structure |
The init structure has been removed and moved into
|
|
The handle structure has been renamed to
|
|
|
The structure
|
|
|
|
|
|
New APIs are available to get and set SMBUS features. |
|
|
Two functions to Set/Get User Data are available:
|
|
|
Individual callback registration APIs replace global register and unregister functions |
The callback registration is handled by specific functions for each SMBUS event. |
|
HAL SMBUS APIs now rely on LL APIs rather than performing direct register access. |
|
|
Define statements and enumerations redirected to LL equivalents |
HAL SMBUS define statements and enumerations are based on LL define statements. |
|
All hardware macros have been removed from the HAL SMBUS driver, and equivalent services are ensured through the LL APIs. |
|
|
The SMBUS state machine is reworked to ensure transitions of the peripheral functional states |
|
|
The HAL SMBUS functions were updated to return:
|
|
|
The HAL error handling mechanisms have been redesigned to improve the detection, reporting, and handling of errors. |
|
|
All TypeDef parts of the HAL SMBUS driver have been removed and replaced by
|
|
|
For the HAL SMBUS driver, large macros have been replaced by inline functions to maintain code consistency, improve readability, and benefit from compiler optimization. Inline functions also offer better support for debugging and strict type management, reducing the risk of errors. |
|
|
Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable. |
|
|
The parameters and state are checked using
|
|
|
Merge HAL extension files with common ones and remove the EX prefix from APIs. |
Only one HAL SMBUS header file remains and all macros, define statements, and functions from
|
|
Provide RTOS-compatible acquire/release bus services for communication peripheral drivers. |
Implementing functions to manage the access to communication buses like SMBUS in a multi-tasking environment. These services ensure that only one task can use the bus at a time, preventing conflicts and ensuring data integrity. The acquire function locks the bus for a task, while the release function unlocks it, allowing other tasks to use the bus. |
|
Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels. |
Finite parameters (including SMBUS instances) have been converted into enumerated types (enums) at HAL level. This improves code readability, maintainability, and type safety. |
|
Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions). |
All HAL SMBUS functions start with
|
Other HAL SMBUS changes ¶
|
Concept |
Consideration |
|---|---|
|
Provide APIs for timeout configuration |
Add (
|
|
Provide APIs for timing calculation |
Add (
|